using CsvHelper.Configuration.Attributes;

namespace BreadthFirst
{
    public class People
    {
        public string Name { get; set; }
        public bool IsDealer { get; set; }

        [Name("Neighbors")]
        public string neighbors { get; set; }

        [Ignore]
        public string[] Neighbors
        {
            get
            {
                if (!string.IsNullOrWhiteSpace(neighbors))
                    return neighbors.Split('|');
                else return new string[0];
            }
            set
            {
                neighbors = string.Join("|", value);
            }
        }

        [Ignore]
        public bool HasChildren
        {
            get
            {
                return Neighbors.Length > 0;
            }
        }

        [Ignore]
        public bool Searched { get; set; }
        public People()
        {

        }
        public People(string name, string[] neighbors, bool isDealer)
        {
            Name = name;
            Neighbors = neighbors;
            IsDealer = isDealer;
        }
    }
}
